using System.Data.Entity.ModelConfiguration;
using Model.Database;

namespace Model.Mapping
{
    public class TreeDataItemMap : EntityTypeConfiguration<TreeDataItem>
    {
        public TreeDataItemMap()
        {
            // Primary Key
            this.HasKey(t => t.TreeDataItemId);

            // Properties
            this.Property(t => t.Text)
                .IsRequired()
                .HasMaxLength(25);

            this.Property(t => t.Description)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("TreeDataItem");
            this.Property(t => t.TreeDataItemId).HasColumnName("TreeDataItemId");
            this.Property(t => t.TreeDataHeadId).HasColumnName("TreeDataHeadId");
            this.Property(t => t.ParentId).HasColumnName("ParentId");
            this.Property(t => t.Text).HasColumnName("Text");
            this.Property(t => t.Disable).HasColumnName("Disable");
            this.Property(t => t.Description).HasColumnName("Description");
            this.Property(t => t.Sort).HasColumnName("Sort");
            this.Property(t => t.AddTime).HasColumnName("AddTime");
            this.Property(t => t.ModifyTime).HasColumnName("ModifyTime");
        }
    }
}
